//Source file: D:\\test\\com\\ce\\pms\\custservice\\model\\SubmitTaskDO.java

package com.ce.pms.custservice.model;

import javax.persistence.*;

import com.ce.pms.common.model.HmDeptDomain;
import com.ce.pms.common.model.SysInfo;
import com.ce.pms.common.model.SysrefcodeDO;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实体名称:提交任务DO 关联数据表:CE_DISPATCH_EVENT
 *
 * @author yandawei
 * @CreateDate:2008-12-8
 */
@Entity
@Table(name = "CE_DISPATCH_EVENT")
public class SubmitTaskDO implements IDomainObject {

	/**
	 * 状态:001待处理
	 */
	public static final String TASK_PREPARE_HANDLE_CODE = "001";

	/**
	 * 状态:002处理中
	 */
	public static final String TASK_ACCEPTED_HANDLE_CODE = "002";

	/**
	 * 状态:003处理完毕
	 */
	public static final String TASK_COMPLETE_REPLY_CODE = "003";

	/**
	 * 有效性：0 无效
	 */
	public static final String TASK_VALIDITY_INVALID_CODE = "0";
	/**
	 * 有效性：1 有效
	 */
	public static final String TASK_VALIDITY_VALID_CODE = "1";
	/**
	 * 提交方式：1 为主动提交(手工创建)
	 */
	public static final String TASK_SUBMIT_TYPE_MANUAL = "1";
	/**
	 *  提交方式: 0 为被动(隐患创建)
	 */
	public static final String TASK_SUBMIT_TYPE_IMPLIED = "0";
	/**
	 * 任务ID
	 */
	@Id
	@GeneratedValue
	@Column(name = "DISPATCH_EVENT_ID")
	private Long keyword;

	/**
	 * 部门负责人
	 */
	@Column(name = "DEPT_PRINCIPAL", length = 36)
	private String deptPrincipal;

	/**
	 * 反馈意见
	 */
	@Column(name = "REPLY_VIEWS", length = 200)
	private String replyViews;

	/**
	 * 处理意见
	 */
	@Column(name = "DEAL_VIEWS", length = 200)
	private String dealViews;

	/**
	 * 状态:001待处理;002处理中;003处理完毕
	 */
	@Column(name = "STATUZ", nullable = false, length = 3)
	private String statuz;

	/**
	 * 催请次数
	 */
	@Column(name = "FREQUENCY", nullable = false)
	private Short frequency;

	/**
	 * 1有效;0无效
	 */
	@Column(name = "VALIDITY", nullable = false, length = 1)
	private String validity;

	/**
	 * 部门
	 */
	@OneToOne
	@JoinColumn(name = "DEPT_ID")
	private HmDeptDomain deptDO;

	/**
	 * 客服事件
	 */
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	@JoinColumn(name = "CUST_SERVICE_EVENT_ID")
	private CustServiceEventDO custServiceEventDO;

	/**
	 * 系统信息
	 */
	@Embedded
	private SysInfo sysInfo;

	/**
	 * 提交方式：1为主动提交(手工创建)，0为被动(隐患创建)
	 */
	@Column(name = "AUTO_SUBMIT", nullable = false)
	private String submitType = TASK_SUBMIT_TYPE_IMPLIED;

	/***************************************************************************
	 * 备注
	 */
	@Column(name = "REMARK", length = 200)
	private String remark;

	/**
	 * 默认构造器
	 *
	 * @return com.ce.pms.custservice.model.SubmitTaskDO
	 * @roseuid 4936251D0000
	 */
	public SubmitTaskDO() {
		this.frequency = 0;
		initAllStatuz();
	}

	/**
	 * 自定义构造器
	 *
	 * @param keyword -
	 *            任务ID
	 * @return com.ce.pms.custservice.model.SubmitTaskDO
	 * @roseuid 4923DD4703D8
	 */
	public SubmitTaskDO(Long keyword) {
		this.keyword = keyword;
		this.frequency = 0;
		initAllStatuz();
	}

	/**
	 * 功能描述: 1. 设置状态Statuz待处理 statuz=001 2. 设置是否有效Validity有效 alidity=1 <br>
	 *
	 * Create author:yandawei <br>
	 * Create on:2008-12-8 <br>
	 * Edit author: <br>
	 * Edit on: <br>
	 * Why: <br>
	 */
	private void initAllStatuz() {
		setStatuz(TASK_PREPARE_HANDLE_CODE);
		setValidity(SysrefcodeDO.CONSTANTS_DIGITAL_ONE);
	}

	/***************************************************************************
	 * 功能描述: 设置是否有效"无效"validity=0<br>
	 *
	 * Create author:yandawei <br>
	 * Create on:2008-12-8 <br>
	 * Edit author: <br>
	 * Edit on: <br>
	 * Why: <br>
	 */
	public void setValidityFalse() {
		setValidity(SysrefcodeDO.CONSTANTS_DIGITAL_ZERO);
	}

	/**
	 * 设置状态处理中(创建派工单) statuz=002
	 *
	 * @roseuid 4923DE050109
	 */
	public void setStatuzProcessing() {
		setStatuz(TASK_ACCEPTED_HANDLE_CODE);
	}

	/**
	 * 设置状态部门已回复 statuz=003
	 *
	 * @roseuid 493601F5033C
	 */
	public void setStatuzHasReplay() {
		setStatuz(TASK_COMPLETE_REPLY_CODE);
	}

	/**
	 * 登记部门回复内容
	 *
	 * @param remark
	 * @roseuid 492D034702CE
	 */
	public void setDeptReplyViews(String replyViews) {
		setReplyViews(replyViews);
	}

	/**
	 * 登记部门处理意见
	 *
	 * @param remark
	 * @roseuid 492D034702CE
	 */
	public void setDeptDealViews(String dealViews) {
		setDealViews(dealViews);
	}

	/**
	 * 增加催请次数 ++frequency
	 *
	 * @roseuid 4925313C0261
	 */
	public void increaseFrequency() {
		++this.frequency;
	}

	public String getDeptPrincipal() {
		return deptPrincipal;
	}

	public void setDeptPrincipal(String deptPrincipal) {
		this.deptPrincipal = deptPrincipal;
	}

	public Short getFrequency() {
		return frequency;
	}

	public void setFrequency(Short frequency) {
		this.frequency = frequency;
	}

	public Long getKeyword() {
		return keyword;
	}

	public void setKeyword(Long keyword) {
		this.keyword = keyword;
	}

	public String getStatuz() {
		return statuz;
	}

	public void setStatuz(String statuz) {
		this.statuz = statuz;
	}

	public SysInfo getSysInfo() {
		return sysInfo;
	}

	public void setSysInfo(SysInfo sysInfo) {
		this.sysInfo = sysInfo;
	}

	public CustServiceEventDO getCustServiceEventDO() {
		return custServiceEventDO;
	}

	public void setCustServiceEventDO(CustServiceEventDO custServiceEventDO) {
		this.custServiceEventDO = custServiceEventDO;
	}

	public HmDeptDomain getDeptDO() {
		return deptDO;
	}

	public void setDeptDO(HmDeptDomain deptDO) {
		this.deptDO = deptDO;
	}

	public String getValidity() {
		return validity;
	}

	public void setValidity(String validity) {
		this.validity = validity;
	}

	public String getDealViews() {
		return dealViews;
	}

	public void setDealViews(String dealViews) {
		this.dealViews = dealViews;
	}

	public String getReplyViews() {
		return replyViews;
	}

	public void setReplyViews(String replyViews) {
		this.replyViews = replyViews;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return the submitType
	 */
	public String getSubmitType() {
		return submitType;
	}

	/**
	 * @param submitType the submitType to set
	 */
	public void setSubmitType(String submitType) {
		this.submitType = submitType;
	}

}
